import reshandler from 'services/response-handler'
/**
 * 查看商品
 * @returns response {
 *   product    产品
 *   promotions 促销
 *   shop       店铺
 * }
 */
function makeData(response) {
  return Object.assign({}, response, {
    product: response.product || {},
    promotions: response.promotions || [],
    shop: response.shop || {}
  })
}
export default function (params, success, fail) {
  // request 
  params = Object.assign({}, params, {
    methodName: "QueryProductInfo"
  })

  // invoke
  this.$.get(params)
    .then(reshandler.success(success, fail, makeData), reshandler.error(fail))
}
